{% extends "personal_center/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link href="../../static/personnel/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        .performance {
            width: 100%;height: 40px;line-height: 40px;padding-left: 10px;border-bottom: #999999 dashed 1px;cursor: pointer;
        }
        .performance_active {
            background: #2db7f5;color: white;border-bottom: #2db7f5 dashed 1px;
        }
        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 2px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }
        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }
        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }
        .shade {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        .sheet {
            width: 90px;height: 35px;border-top-right-radius: 5px;border-top-left-radius: 5px;border: #cfcfcf solid 1px;font-size: 12px;
        }
        .sheet:hover {
            background: #2db7f5;color: white;border: #2db7f5 solid 1px;
        }
        .sheet_active {
            background: #2db7f5;color: white;border: #2db7f5 solid 1px;
        }
        .merits {
            display: inline-block;vertical-align: top;width: 80px;height: 40px;line-height: 40px;text-align: center;cursor: pointer;
        }
        .merits_active {
            display: inline-block;vertical-align: top;width: 80px;height: 40px;line-height: 40px;text-align: center;cursor: pointer;color: #2db7f5;border-bottom: #2db7f5 solid 3px;
        }
        .personnel_allotment {
            width: 100%;height: 80%;border-bottom: #cfcfcf solid 1px;overflow: auto;
        }
        .personnel_allotment::-webkit-scrollbar {
          display: none;
        }
        .presentation {
            width: 100px;height: 35px;background: #00BFFF;border: #00BFFF solid 1px;border-radius: 3px;cursor: pointer;color: white;
        }
        .presentation:hover {
            background: #1C86EE;border: #1C86EE solid 1px;
        }
        .preserve {
            width: 100px;height: 35px;background: #6dbfff;border: #6dbfff solid 1px;border-radius: 3px;cursor: pointer;color: white;margin-left: 20px;
        }
        .preserve:hover {
            background: #1E90FF;border: #1E90FF solid 1px;
        }
        .DirectorCancel {
            width: 80px;height: 30px;background: #CCCCCC;border: #CCCCCC solid 1px;color: white;border-radius: 3px;
        }
        .DirectorCancel:hover {
            background: #c3c3c3;border: #c3c3c3 solid 1px;
        }
        .DirectorConfirm {
            width: 80px;height: 30px;background: #6dbfff;border: #6dbfff solid 1px;color: white;border-radius: 3px;margin-left: 10px;
        }
        .DirectorConfirm:hover {
            background: #0d8ddb;border: #0d8ddb solid 1px;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 15%;height: 95%;margin-top: 1.25%;display: inline-block;vertical-align: top;background: white;border: #cfcfcf solid 1px;margin-left: 1%;">
        <div onclick="window.location.href='/supervision-inspection/performance_management.html'" class="performance">
            绩效分配
        </div>
        <div onclick="window.location.href='/supervision-inspection/supervise_completed.html'" class="performance performance_active">
            绩效汇总
        </div>
        <div onclick="window.location.href='/supervision-inspection/department_performance.html'" class="performance" {% if share_flag == 'true' %}style="color: red;"{% endif %}>
            科室绩效
        </div>
        <div onclick="choose_performance_type(this, 4)" class="performance">
            我的绩效
        </div>
    </div>

    <div style="width: 82%;height: 95%;margin-top: 1.25%;display: inline-block;vertical-align: top;background: white;border: #cfcfcf solid 1px;margin-left: 0.5%;">
        <div style="width: 100%;height: 100%;" id="performance_allocation">
            {% if upload_flag == 'true' %}
                {% if obj_count == 'true' %}
                    <div style="width: 100%;height: 40px;border-bottom: #cfcfcf solid 1px;">
                        <div style="float: left;margin-left: 15px;display: inline-block;vertical-align: top;">
                            <button style="width: 100px;height: 30px;margin-top: 5px;border: #bd2130 solid 1px;background: #bd2130;color: white;" onclick="javascript:window.location.href='/static/supervision_inspection/file_model/绩效模板.xlsx'">下载模板</button>
                            <button style="width: 100px;height: 30px;margin-top: 5px;border: #2db7f5 solid 1px;background: #2db7f5;color: white;margin-left: 10px;" onclick="upload_director_performance()">上传绩效</button>
                        </div>
                        <div style="float: right;margin-right: 15px;display: inline-block;vertical-align: top;">
                            <div style="display: inline-block;vertical-align: top;width: 200px;height: 40px;padding-top: 5px;">
                                <select name="" id="search_dep" style="width: 100%;height: 30px;border: #cfcfcf solid 1px;border-radius: 3px;outline: none;" class="dept_select">
                                    <option value="">请选择科室</option>
                                    {% for dp in dep_list %}
                                        <option value="{{ dp.code }}" {% if SearchDep == dp.code %}selected{% endif %}>{{ dp.name }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                            <div style="display: inline-block;vertical-align: top;width: 200px;height: 40px;padding-top: 5px;">
                                <select name="" id="search_year" style="width: 100%;height: 30px;border: #cfcfcf solid 1px;border-radius: 3px;outline: none;" class="dept_select">
                                    <option value="">请选择年份</option>
                                    {% for year in year_list %}
                                        <option value="{{ year }}" {% if SearchYear == year %}selected{% endif %}>{{ year }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                            <div style="display: inline-block;vertical-align: top;width: 200px;height: 40px;padding-top: 5px;">
                                <select name="dept" style="width: 100%;height: 30px;border: #cfcfcf solid 1px;border-radius: 3px;outline: none;" id="search_month" class="dept_select">
                                    <option value="">请选择月份</option>
                                    {% for month in month_list %}
                                        <option value="{{ month }}" {% if SearchMonth == month %}selected{% endif %}>{{ month }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                            <input type="text" id="search_key" style="width: 300px;height: 30px;margin-top: 5px;border: #cfcfcf solid 1px;border-radius: 3px;" value="{{ SearchKey }}">
                            <button onclick="search_button()" style="width: 100px;height: 30px;margin-top: 5px;letter-spacing: 5px;background: #2db7f5;border: #2db7f5 solid 1px;color: white;">搜索</button>
                        </div>
                    </div>
                    <div id="total_performance_detail" style="width: 100%;height: 95%;">
                        <div id="table_detail" style="width: 100%;height: 100%;overflow-x: auto;">
                            <table id="main_table" style="width: 1680px;">
                                <tr style="width: 100%;border-bottom: #cfcfcf solid 1px;">
                                    <th style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">科室编号</th>
                                    <th style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">科室</th>
                                    <th style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">职务</th>
                                    <th style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">类别</th>
                                    <th style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">工号</th>
                                    <th style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">姓名</th>
                                    <th style="width: 200px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">银行帐号</th>
                                    <th style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">工作量绩效</th>
                                    <th style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">夜班绩效</th>
                                    <th style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">医共体绩效</th>
                                    <th style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">绩效工资合计</th>
                                    <th style="width: 120px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">科主任管理绩效</th>
                                    <th style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">会诊绩效</th>
                                    <th style="width: 120px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">门诊专项绩效</th>
                                    <th style="width: 120px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">其他单项绩效</th>
                                    <th style="width: 100px;height: 35px;text-align: center;">人才储备绩效</th>
                                </tr>
                                {% for foo in obj %}
                                    <tr style="width: 100%;border-bottom: #cfcfcf solid 1px;">
                                        <td style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.department_code }}</td>
                                        <td style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.department_name }}</td>
                                        <td style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.duties }}</td>
                                        <td style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.identity }}</td>
                                        <td style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.job_number }}</td>
                                        <td style="width: 80px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.real_name }}</td>
                                        <td style="width: 200px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.bank_account }}</td>
                                        <td style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.workload }}</td>
                                        <td style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.night_shift_performance }}</td>
                                        <td style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.medical_community }}</td>
                                        <td style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.total_salary }}</td>
                                        <td style="width: 120px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.managing_performance }}</td>
                                        <td style="width: 100px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.consultation_performance }}</td>
                                        <td style="width: 120px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.special_performance }}</td>
                                        <td style="width: 120px;height: 35px;text-align: center;border-right: #cfcfcf solid 1px;">{{ foo.individual_performance }}</td>
                                        <td style="width: 100px;height: 35px;text-align: center;">{{ foo.reserve_performance }}</td>
                                    </tr>
                                {% endfor %}
                            </table>
                        </div>
                    </div>
                {% else %}
                    <div style="width: 30%;height: 30%;margin-top: 18%;margin-left: 30%;text-align: center;">
                        <img src="../../static/personal_center/img/暂无资源.png" alt="" style="width: 120px;height: 120px;margin-top: 30px;">
                        <p style="color: #cfcfcf;">暂无数据</p>
                    </div>
                {% endif %}
            {% else %}
                <div style="width: 30%;height: 30%;margin-top: 18%;margin-left: 30%;text-align: center;">
                    <img src="../../static/personal_center/img/暂无资源.png" alt="" style="width: 120px;height: 120px;margin-top: 30px;">
                    <p style="color: #cfcfcf;">无权限访问</p>
                </div>
            {% endif %}
        </div>

        <div style="width: 100%;height: 100%;overflow: auto;display: none;" id="performance_statistics"></div>
        <div style="width: 100%;height: 100%;overflow: auto;display: none;" id="department_performance">

        </div>
        <div style="width: 100%;height: 100%;overflow: auto;display: none;" id="my_performance">
            <div style="width: 30%;height: 30%;margin-top: 18%;margin-left: 30%;text-align: center;">
                <img src="../../static/personal_center/img/暂无资源.png" alt="" style="width: 120px;height: 120px;margin-top: 30px;">
                <p style="color: #cfcfcf;">该功能暂未开放</p>
            </div>
        </div>
    </div>

    <div id="upload_meeting_minutes" class="shade">
        <div id="meeting_minutes" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 1000px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #F5F5F5 solid 1px;">
                <div id="minutes" style="width: 100%;height: 40px;background: white;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;">
                    <h6 class="modal-title" style="line-height: 40px;width: 35%;margin-left: 1%;display: inline-block;">绩效分配</h6>
                    <span onclick="close_models()" style="float: right;line-height: 40px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
                </div>

                <div style="width: 100%;padding-bottom: 10px;">
                    <div style="width: 98%;margin-top: 10px;margin-left: 1%;background: white;border-radius: 3px;">
                        <div style="width: 100%;height: 50px;">
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;">
                                <div style="display: inline-block;width: 105px;text-align-last: justify;">姓名</div><span>：</span>
                                <input id="real-name" type="text" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;" disabled>
                            </div>
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;margin-left: 15px;">
                                <div style="display: inline-block;width: 80px;text-align-last: justify;">工号</div><span>：</span>
                                <input id="job-number" type="text" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;" disabled>
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;">
                                <div style="display: inline-block;width: 105px;text-align-last: justify;">科室</div><span>：</span>
                                <input id="company-name" type="text" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;" disabled>
                            </div>
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;margin-left: 15px;">
                                <div style="display: inline-block;width: 80px;text-align-last: justify;">科室编号</div><span>：</span>
                                <input id="company-code" type="text" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;" disabled>
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;">
                                <div style="display: inline-block;width: 105px;text-align-last: justify;">职务</div><span>：</span>
                                <input id="duties-name" type="text" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;">
                            </div>
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;margin-left: 15px;">
                                <div style="display: inline-block;width: 80px;text-align-last: justify;">医生/护士</div><span>：</span>
                                <input id="identity-name" type="text" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;">
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;">
                                <div style="display: inline-block;width: 105px;text-align-last: justify;">银行账号</div><span>：</span>
                                <input id="bank-account" type="number" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;">
                            </div>
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;margin-left: 15px;">
                                <div style="display: inline-block;width: 80px;text-align-last: justify;">工作量绩效</div><span>：</span>
                                <input id="workload-performance" type="number" onblur="AllPerformance(1)" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;">
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;">
                                <div style="display: inline-block;width: 105px;text-align-last: justify;">夜班绩效</div><span>：</span>
                                <input id="night-performance" type="number" onblur="AllPerformance(2)" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;">
                            </div>
                            <div style="height: 50px;padding-top: 7px;padding-left: 10px;display: inline-block;vertical-align: top;margin-left: 15px;">
                                <div style="display: inline-block;width: 80px;text-align-last: justify;">医共体绩效</div><span>：</span>
                                <input id="medical-performance" type="number" onblur="AllPerformance(3)" style="width: 345px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;" >
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;padding-top: 7px;padding-left: 10px;">
                            <div style="display: inline-block;width: 105px;text-align-last: justify;">绩效工资合计</div><span>：</span>
                            <input id="total-performance" type="text" style="width: 820px;border: #cfcfcf solid 1px;border-radius: 3px;padding-left: 1%;display: inline-block;" disabled>
                        </div>
                    </div>
                </div>

                <div style="width: 100%;height: 40px;text-align: right;padding-right: 2%;background: white;">
                    <button id="SubmitSummary" onclick="save_data()" style="width: 100px;height: 30px;border: #dfdfdf solid 1px;border-radius: 3px;background: #1E90FF;color: white;margin-top: 5px;">
                        保存
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="DirectorPerformance" class="shade">
        <div id="DirectorPerformanceModel" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 500px;background: white;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: white solid 1px;">
                <div id="DirectorPerformanceTitle" style="width: 100%;height: 40px;border-bottom: #cfcfcf solid 1px;">
                    <h6 class="modal-title" style="line-height: 40px;width: 35%;margin-left: 1%;display: inline-block;">绩效上传</h6>
                    <span onclick="upload_director_performance_close()" style="float: right;line-height: 40px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
                </div>
                <div style="width: 100%;padding-bottom: 20px;">
                    <div style="width: 100%;height: 40px;margin-top: 20px;">
                        <input id="upload_year" type="number" style="width: 80%;height: 30px;border: #CCCCCC solid 1px;border-radius: 3px;margin-top: 5px;margin-left: 10%;" placeholder="请输入年份">
                    </div>
                    <div style="width: 100%;height: 40px;">
                        <input id="upload_month" type="number" style="width: 80%;height: 30px;border: #CCCCCC solid 1px;border-radius: 3px;margin-top: 5px;margin-left: 10%;" placeholder="请输入月份">
                    </div>
                    <div style="width: 100%;height: 100px;margin-top: 5px;">
                        <div style="width: 100px;height: 100px;display: inline-block;vertical-align: top;margin-left: 10%;">
                            <a href="javascript:;" class="file">
                                <img src="../../static/personal_center/img/加号_o.png" alt="" onclick="onclick_upload_file()" style="width: 70px;height: 70px;vertical-align: baseline;">
                                <input type="file" name="regular_main_body" id="regular_main_body" onchange="upload_accessory()">
                            </a>
                        </div>

                        <div id="upload_file_list" style="width: 60%;height: 100%;display: inline-block;vertical-align: top;">

                        </div>
                    </div>
                </div>
                <div style="width: 100%;height: 40px;text-align: center;">
                    <button class="DirectorCancel" onclick="upload_director_performance_close()">取&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;消</button>
                    <button class="DirectorConfirm" onclick="upload_summit()">确&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;认</button>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script src="../../static/personnel/js/jquery-1.11.1.min.js"></script>
    <script src="../../static/personnel/js/jquery.searchableSelect.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("personage").className = "add_class";
            document.getElementById("supervision_inspection_management").className = "add-nav-active";
        };

        function choose_performance_type(ele, type_number) {
            var performance_obj = document.getElementsByClassName("performance");
            for (var i=0; i<performance_obj.length; i++) {
                performance_obj[i].className = "performance";
            }
            ele.className = "performance performance_active";

            if (type_number === 1) {
                document.getElementById("performance_allocation").style.display = "block";
                document.getElementById("performance_statistics").style.display = "none";
                document.getElementById("department_performance").style.display = "none";
                document.getElementById("my_performance").style.display = "none";
            }else if (type_number === 2) {
                document.getElementById("performance_statistics").style.display = "block";
                document.getElementById("performance_allocation").style.display = "none";
                document.getElementById("department_performance").style.display = "none";
                document.getElementById("my_performance").style.display = "none";
            }else if (type_number === 3) {
                document.getElementById("department_performance").style.display = "block";
                document.getElementById("performance_allocation").style.display = "none";
                document.getElementById("performance_statistics").style.display = "none";
                document.getElementById("my_performance").style.display = "none";
            }else {
                document.getElementById("my_performance").style.display = "block";
                document.getElementById("performance_allocation").style.display = "none";
                document.getElementById("performance_statistics").style.display = "none";
                document.getElementById("department_performance").style.display = "none";
            }
        }

        function search_button() {
            var search_dep = document.getElementById("search_dep").value;
            var search_year = document.getElementById("search_year").value;
            var search_month = document.getElementById("search_month").value;
            var search_key = document.getElementById("search_key").value;
            window.location.href = '/supervision-inspection/supervise_completed.html?search_dep='+String(search_dep)+"&search_year="+String(search_year)+"&search_month="+String(search_month)+"&search_key="+String(search_key)
        }

        let minutes = document.querySelector("#minutes");
        let meeting_minutes = document.querySelector("#meeting_minutes");

        minutes.addEventListener("mousedown", function (e) {
            let x = e.pageX - meeting_minutes.offsetLeft;
            let y = e.pageY - meeting_minutes.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                meeting_minutes.style.left = e.pageX - x + 'px';
                meeting_minutes.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        let DirectorPerformanceTitle = document.querySelector("#DirectorPerformanceTitle");
        let DirectorPerformanceModel = document.querySelector("#DirectorPerformanceModel");

        DirectorPerformanceTitle.addEventListener("mousedown", function (e) {
            let x = e.pageX - DirectorPerformanceModel.offsetLeft;
            let y = e.pageY - DirectorPerformanceModel.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                DirectorPerformanceModel.style.left = e.pageX - x + 'px';
                DirectorPerformanceModel.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function upload_director_performance() {
            document.getElementById("DirectorPerformance").style.display = "table-row";
        }

        function upload_director_performance_close() {
            document.getElementById("DirectorPerformance").style.display = "none";
        }

        function onclick_upload_file() {
            document.getElementById("regular_main_body").click();
        }

        function upload_accessory() {
            var files = document.getElementById("regular_main_body").files[0];
            creat_table(files.name)
        }

        function creat_table(file_name) {
            var html_str = `
                <div style="width: 100%;height: 40px;line-height: 40px;">
                    <div style="width: 79%;height: 100%;display: inline-block;vertical-align: top;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
                        <a target='_blank' href="javascript:;">`+file_name+`</a>
                    </div>
                    <div onclick="RemoveTr(this)" style="width: 18%;height: 100%;display: inline-block;vertical-align: top;text-align: center;font-size: 12px;cursor: pointer;color: red;">
                        删除
                    </div>
                </div>
            `
            $("#upload_file_list").append(html_str)
        }

        function upload_summit() {
            var upload_year = document.getElementById("upload_year").value;
            var upload_month = document.getElementById("upload_month").value;
            var files = document.getElementById("regular_main_body").files;

            if (!upload_year) {
                alert("请输入年份！");
                return false
            }

            if (!upload_month) {
                alert("请输入月份！");
                return false
            }

            if (!files.length) {
                alert("请上传绩效！");
                return false
            }
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            form.append("file", files[0]);
            form.append("upload_year", upload_year);
            form.append("upload_month", upload_month);
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/supervision-inspection/supervise_completed.html", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        alert("上传成功！")
                        window.location.reload();
                    }
                }
            };
        }
    </script>
{% endblock %}
